<template>
    <div>
        <table class="table">
            <tbody>
                <tr>
                    <td>编号</td>
                    <td>
                        <input type="text" disabled v-model="date.memberiD">
                    </td>
                </tr>
                <tr>
                    <td>商铺名称</td>
                    <td>
                        <input type="text" v-model="date.memberName">
                    </td>
                </tr>
                <!-- <tr>
                    <td>楼层</td>
                    <td>
                        <select v-model="date.louceng">
                            <option value="请选择">请选择</option>
                            <option value="1楼">1楼</option>
                            <option value="2楼">2楼</option>
                            <option value="3楼">3楼</option>
                        </select>
                    </td>
                </tr -->
                <tr>
                    <td>面积</td>
                    <td>
                        <input type="text" v-model="date.mianji">
                    </td>
                </tr>
                <!-- <tr>
                    <td>商铺状态</td>
                    <td>
                       <select v-model="date.state">
                            <option value="请选择">请选择</option>
                            <option value="出租">出租</option>
                            <option value="空置">空置</option>
                        </select>
                    </td>
                </tr> -->
                <tr>
                    <td>房屋类型</td>
                    <td>
                        <select v-model="date.houseId">
                            <option value="0">请选择</option>
                            <option v-for="b in data" :value="b.houseId">{{ b.houseName }}</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>电话</td>
                    <td>
                        <input type="text" v-model="date.phone">
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="button" value="修改" @click="update">
                    </td>
                </tr>
            </tbody>
        </table>
        <a href="/Show">返回显示列表</a>
    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref,onMounted } from 'vue';
import { useRouter,useRoute } from 'vue-router';
const routher = useRouter();
const routhe = useRoute();
onMounted(()=>{
    getdate()
    upd()
})
const getdate=()=>{
    axios.get("/api/House/GetHouseList").then(res=>{
        data.value=res.data
    })
}
const data=ref([{
    "houseId": 0,
    "houseName": ""
}])
const upd=()=>{
    var vid = routhe.query.id
    axios.get("/api/Member/FanMember",{params:{id:vid}}).then(res=>{
        date.value=res.data
    })
}
const update=()=>{
    axios.put("/api/Member/UpdMember",date.value).then(res=>{
        if(res.data>0){
            alert("修改成功")
            routher.push({path:"/Show"})
        }
        else{
            alert("修改失败")
        }
    })
}
const date=ref({
    "houseId": 0,
    "memberName": "",
    "memberiD": 0,
    "mianji": "",
    //"state": "",
    //"bian": "",
    //"delDates": null,
    //"isDelete": false,
    //"louceng": "",
    "phone": "",
    "houseName": ""
})
</script>

<style scoped>

</style>